package gjw.photodialog;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

/**
 * @创建者 Jimven
 * @创建时间 2017/12/27/0027  14:11
 */
public class CodeDialog extends Dialog {
    public  Context              mContext;
    public  View.OnClickListener mClickListener;
    private ImageView            mIv_close_dialog;
    private ImageView            mRecriver_code;
    private EditText             mEt_input_code;
    private Button               mBtn_check_code;

    public CodeDialog(Context context) {
        super(context);
        this.mContext = context;
    }

    public CodeDialog(Activity context, int theme, View.OnClickListener clickListener) {
        super(context, theme);
        this.mContext = context;
        this.mClickListener = clickListener;

    }

    protected CodeDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_code_dialog);
        mIv_close_dialog = (ImageView) findViewById(R.id.iv_close_dialog);
        mRecriver_code = (ImageView) findViewById(R.id.recriver_code);
        mEt_input_code = (EditText) findViewById(R.id.et_input_code);
        mBtn_check_code = (Button) findViewById(R.id.btn_check_code);
        mIv_close_dialog.setOnClickListener(mClickListener);
        mRecriver_code.setOnClickListener(mClickListener);
        mBtn_check_code.setOnClickListener(mClickListener);
        this.setCanceledOnTouchOutside(false);

        WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
        Window window = getWindow();
        lp.copyFrom(window.getAttributes());
        lp.x = WindowManager.LayoutParams.WRAP_CONTENT;
        lp.y = -500;

        window.setAttributes(lp);
    }
}
